<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    const pc = ['海尔', '联想', '小米', '方正'];

    function getValue() {
      return [100, 60]
    }


    // 1. 变量多， 单元值少
    const [a, b, c, d] = [1, 2, 3]
    console.log(a, b, c, d);
    // 2. 变量少， 单元值多
    const [x, y, z] = [1, 2, 3, 4]
    console.log(x, y, z);
    // 3. 剩余参数 变量少， 单元值多
    const [e, f, ...g] = [1, 2, 3, 4, 5]
    console.log(e, f, g);
    // 4. 防止 undefined 传递

    // 5. 按需导入赋值
    const [h, i, , j] = [1, 2, 3, 4]
    console.log(h, i, j);



    const arr = [10, 20, 30]
    function fn([k, l, m]) {
      console.log(k, l, m);
    }
    fn(arr)
    // 6. 多维数组解构

  </script>


</body>

</html>